{% extends "plain.html" %}

{% block body %}
<div style="text-align: left">
<script type="text/javascript">
function pad(n) {
    return n < 10 ? "0" + n.toString() : n.toString();
}

function setDate() {
    elem = document.getElementById('date_posted');
    date = new Date();
    text = date.getFullYear() + "-" + pad(date.getMonth() + 1) + "-" + pad(date.getDate()) + " " +
           pad(date.getHours()) + ":" + pad(date.getMinutes());
    elem.value = text;
}
</script>
<form method="POST" action="" enctype="multipart/form-data">
<table>
<tr>
    <td><label for="date_posted">Date posted:</label></td>
    <td>
        <input type="text" name="date_posted" id="date_posted" value="{{ photo.get_date_posted_for_edit }}" />
        <a href="javascript:setDate();">Set to now</a>
    </td>
</tr>
<tr>
    <td><label for="title">Title:</label></td>
    <td><input type="text" name="title" id="title" value="{{ photo.title }}" /></td>
</tr>
<tr>
    <td><label for="slug">Slug:</label></td>
    <td>
        <input type="text" name="slug" id="slug" value="{{ photo.get_slug }}" />
        <a href="javascript:setSlug('title', 'slug');">Get from title</a>
    </td>
</tr>
<tr>
    <td><label for="location">Location:</label></td>
    <td><input type="text" name="location" id="location" value="{{ photo.location }}" /></td>
</tr>
<tr>
    <td><label for="categories">Categories:</label></td>
    <td><input type="text" name="categories" id="categories" value="{{ photo.categories }}" /> (separated by comma)</td>
</tr>
<tr>
    <td><label for="description">Description:</label></td>
    <td><input type="text" name="description" id="description" value="{{ photo.description }}" /></td>
</tr>
<tr>
    <td><label for="file">File:</label></td>
    <td><input type="file" name="file" id="file" /></td>
</tr>
</table>
<input type="submit" value="Add" />
</form>
</div>
{% endblock %}
